//
//  NewAddIntentionSheetViewController.m
//  BlackBambooCM-OC
//
//  Created by DKang on 2018/11/26.
//  Copyright © 2018年 ucanmax. All rights reserved.
//

#import "NewAddIntentionSheetViewController.h"
#import "NewAddIntentionSheetCell.h"
#import "IntentionSheetDetailViewController.h"

static NSString *newAddIntentionSheetCellId = @"NewAddIntentionSheetCell";

@interface NewAddIntentionSheetViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableView;

@end

@implementation NewAddIntentionSheetViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initTableView];
    [self initNav];
}

- (void) initNav {
    self.title = @"新增意向单";
    [self addNavigationItemWithImgs:@[@"backWhite"] isLeft:YES  target:self action:@selector(backBtnClicked) tags:@[@(0)]];
    [self addNavigationItemWithImgs:@[@"white_add"] isLeft:NO  target:self action:@selector(addNewsIntentionSheet) tags:@[@(0)]];
}

- (void)initTableView {
    [self.tableView registerNib:[UINib nibWithNibName:@"NewAddIntentionSheetCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:newAddIntentionSheetCellId];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NewAddIntentionSheetCell *cell = [tableView dequeueReusableCellWithIdentifier:newAddIntentionSheetCellId];
    if (!cell){
        cell = [[NewAddIntentionSheetCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:newAddIntentionSheetCellId];
    }
    return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 10;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 80;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    IntentionSheetDetailViewController *detailVC = [[IntentionSheetDetailViewController alloc]initWithNibName:@"IntentionSheetDetailViewController" bundle:[NSBundle mainBundle]];
    [self.navigationController pushViewController:detailVC animated:YES];
}
- (void)addNewsIntentionSheet {
    IntentionSheetDetailViewController *detailVC = [[IntentionSheetDetailViewController alloc]initWithNibName:@"IntentionSheetDetailViewController" bundle:[NSBundle mainBundle]];
    [self.navigationController pushViewController:detailVC animated:YES];
}
@end
